import { cardCache, toast } from 'nc-lightapp-front';
import config from '../config';
const { setDefData } = cardCache;

export default function (props, moduleId, record, index, status) {
    const checkedRows = props.table.getCheckedRows(moduleId);
    if (checkedRows.length === 1) {
        props.button.setButtonDisabled(['more'], false);
        const record = checkedRows[0].data.values;
        if (record.src_type.value === '0') {
            if (record.billstatus.value === '0') {
                props.button.setButtonDisabled(['approve_group'], true);
                props.button.setButtonDisabled(['edit', 'delete'], false);
            } else if (record.billstatus.value === '1') {
                props.button.setButtonDisabled(['unapprove'], true);
                props.button.setButtonDisabled(['edit', 'delete', 'approve_group', 'approve'], false);
            } else if (record.billstatus.value === '3') {
                props.button.setButtonDisabled(['edit', 'delete', 'approve'], true);
                props.button.setButtonDisabled(['approve_group', 'unapprove'], false);
            }
        } else {
            props.button.setButtonDisabled(['edit', 'delete', 'approve_group'], true);
        }
    } else {
        props.button.setButtonDisabled(['more', 'edit', 'delete', 'approve_group'], true);
    }
    // else {
    //     props.button.setButtonDisabled(['edit', 'more'], true);
    //     props.button.setButtonDisabled(['delete', 'approve_group'], false);
    // }
}
